package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

func main() {
	//打开文件
	open, err := os.Open("E:/core-site.xml")
	if err == nil {
		fmt.Println(open.Name())
	}
	defer open.Close()

	readFile()
}
func readFile() {
	file, err := os.Open("E:/core-site.xml")
	if err != nil {
		fmt.Println("打开文件失败")
	}
	defer file.Close()
	fmt.Println(file)
	all, err := ioutil.ReadAll(file)
	fmt.Println(string(all))
}
